#!/bin/bash

PROG_NAME="PROG_NAME"

### Web

#zip -r -9  web.zip web

### Linux


TAR_FLAGS="
  --sort=name --format=posix
  --pax-option=exthdr.name=%d/PaxHeaders/%f
  --pax-option=delete=atime,delete=ctime,delete=mtime
  --mtime=@0
  --numeric-owner --owner=0 --group=0
  --mode=go+u,go-w
  --no-acls --no-selinux --no-xattrs
"

for filename in linux/*.zip; do
	tmp_path="/tmp/$PROG_NAME/${filename%.*}"
	mkdir -p $tmp_path
	unzip $filename -d $tmp_path
	#rm -f $filename
	tar $TAR_FLAGS -I "zstd -19" -cf "${filename%.*}.tar.zst" -C $tmp_path .
	rm -r $tmp_path
done

